package com.oa.pm.service;

import com.joneying.common.web.response.Resp;
import com.oa.core.PageResult;
import com.oa.core.exception.BusinessException;
import com.oa.core.exception.DataIsEmptyException;
import com.oa.pm.dto.CompanyDTO;
import com.oa.pm.dto.OrganizationDTO;
import com.oa.pm.dto.OrganizationUpdateDTO;
import com.oa.pm.entity.Organization;
import com.baomidou.mybatisplus.service.IService;
import com.oa.pm.vo.OrganizationTreeVO;
import com.oa.pm.vo.OrganizationVo;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 组织架构表 服务类
 * </p>
 *
 * @author syb123
 * @since 2019-01-22
 */
public interface IOrganizationService extends IService<Organization> {
    /**
     * 自定义分页
     *
     * @param pageNum
     * @param pageSize
     * @return
     */
    PageResult<Organization> findList(Integer pageNum, Integer pageSize);

    /**
     * 根据id查询
     */
    Organization findOrganizationById(String id);

    /**
     * 添加组织架构
     *
     * @param organizationDTO
     * @return
     */
    Resp addOrganization(OrganizationDTO organizationDTO) throws BusinessException;

    /**
     * 新增组织结构-公司
     *
     * @param companyDTO
     * @return
     */
    Resp addCompany(CompanyDTO companyDTO) throws BusinessException;

    /**
     * 根据组织架构主键id查询组织架构详情
     *
     * @param id
     * @return
     */
    Resp findOrganizationDetailsById(String id) throws DataIsEmptyException;

    /**
     * 修改组织结构
     *
     * @param
     * @return
     */
    Resp updateOrganization(OrganizationUpdateDTO organizationUpdateDTO) throws BusinessException;

    /**
     * 根据组织架构主键id删除组织架构
     *
     * @param id
     * @return
     */
    Resp deleteOrganization(String id) throws DataIsEmptyException, BusinessException;

    /**
     * 根据组织架构id查询该部门所属的公司id
     *
     * @param departmentId
     * @return
     */
    String findCompanyIdByDepartmentId(String departmentId);

    List<OrganizationTreeVO> findOrganizationTree(String organizationName, String pId);

    List<OrganizationTreeVO> findOrganizationUserTree();
}
